﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows;

namespace Zero.UControl.Base.Helper.Base
{
    internal class BulkAddCommand : IDrawingCommand
    {
        private readonly Canvas _c;
        private readonly List<UIElement> _els;
        public BulkAddCommand(Canvas canvas, IEnumerable<UIElement> els)
        {
            _c = canvas;
            _els = els.ToList();
        }

        public void Execute()
        {
            foreach (var el in _els)
                if (!_c.Children.Contains(el))
                    _c.Children.Add(el);
        }

        public void UnExecute()
        {
            foreach (var el in _els)
                _c.Children.Remove(el);
        }
    }
}
